/*
 * @Date: 2022-11-05 16:55:34
 * @LastEditors: sailornpg
 * @LastEditTime: 2022-11-08 14:23:30
 * @FilePath: \vue-admin-ts\src\utils\request\index.ts
 * @Description: something
 */
import SAILORRequest from "./service";
import { BASE_URL, TIME_OUT } from "./config";
const sailorRequest = new SAILORRequest({
  baseURL: BASE_URL,
  timeout: TIME_OUT,
  interceptor: {
    requestInterceptor: (config) => {
      const token = localStorage.getItem("token");
      if (token) {
        config.headers!.Authorization = `Bearer ${token}`;
      }
      return config;
    },
    requestInterceptorCatch: (err) => {
      return err;
    },
    responseInterceptor: (res) => {
      return res;
    },
    responseInterceptorCatch: (err) => {
      return err;
    },
  },
});
export default sailorRequest;
